package server

import (
	"6-17yk/common/model/mysql"
	"6-17yk/common/proto/user"
	"errors"
)

func TeamList(list *user.TeamListReq) (*user.TeamListResp, error) {
	teamList, err := mysql.TeamList()
	if err != nil {
		return nil, errors.New("查询失败")
	}
	var lists []*user.TeamList
	for _, team := range teamList {
		lists = append(lists, &user.TeamList{
			InstitutionId: int64(team.InstitutionId),
			TeamName:      team.TeamName,
			TeamNum:       int64(team.TeamNum),
			TeamFaction:   int64(team.TeamFaction),
		})
	}
	return &user.TeamListResp{
		List: lists,
	}, nil
}
